package com.xy.admin.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by pengfei on 17-6-29.
 */
@Controller
@RequestMapping("/admin/login")
public class LoginController {
//    @Autowired
//    private HttpRequest httpRequest;

    @RequestMapping("index")
    public ModelAndView login(){
        ModelAndView modelAndView = new ModelAndView("index");
//        HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        modelAndView.addObject("ctx",System.getProperty("ctx"));
        return modelAndView;
    }

    @RequestMapping("main")
    public ModelAndView main(){
        return new ModelAndView("main");
    }
}
